%%% ======================================================================
%%%  @LaTeX-style-file{
%%%     filename        = "XLingPaper.sty",
%%%     version         = "1.0",
%%%     date            = "Mon 17 August 2009",
%%%     time            = "08:51 UT-7",
%%%     author          = "H. Andrew Black",
%%%     address         = "SIL
%%%                        16131 N Vernon nDrive
%%%                        Tucson, AZ  85739
%%%                        USA",
%%%     email           = "andy_black@sil.org",
%%%     telephone       = "(520) 825-6000",
%%%     FAX             = "(520) 825-6116",
%%%     supported       = "yes",
%%%     archived        = "none",
%%%     distribution    = "freely redistributable",
%%%     keywords        = "LaTeX package, XLingPaper",
%%%     codetable       = "ISO/ASCII",
%%%     checksum        = "",
%%%     docstring       = "XLingPaper.sty is a LaTeX (2e) package.
%%%                        Comments and bug reports welcome!
%%%                        
%%%                        This is a support package for the XLingPaper
%%%                        configuration files for teh XMLmind XML Editor.
%%%                        See http://www.sil.org/~blacka/xlingpap/
%%%                        and http://code.google.com/p/xlingpap/.
%%% }
%%% ======================================================================
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat {LaTeX2e}[1994/12/01]
\def \filename {XLingPaper.sty}
\def \filedate {2009/08/17}
\def \fileversion {1.0}
\ProvidesPackage {XLingPaper}[\filedate\space\fileversion\space
  Contributed and Supported LaTeX2e package]
\typeout {Package: `XLingPaper' \fileversion\space <\filedate>}

\newlength{\leveloneindent}
\newlength{\levelonewidth}
\newlength{\leveltwoindent}
\newlength{\leveltwowidth}
\newlength{\levelthreeindent}
\newlength{\levelthreewidth}
\newlength{\levelfourindent}
\newlength{\levelfourwidth}
\newlength{\levelfiveindent}
\newlength{\levelfivewidth}
\newlength{\levelsixindent}
\newlength{\levelsixwidth}
\newcommand{\XLingPapertableofcontents}{\immediate\openout8 = \jobname.toc\relax
\write8{<toc>}}
\newcommand{\XLingPaperaddtocontents}[1]{\write8{<tocline ref="#1" page="\thepage"/>}}
\newcommand{\XLingPaperendtableofcontents}{\write8{</toc>}\closeout8\relax
}
\newcommand{\XLingPaperdotfill}{\leaders\hbox{$\mathsurround 0pt\mkern 4.5 mu\hbox{.}\mkern 4.5 mu$}\hfill}
\newcommand{\XLingPaperdottedtocline}[4]{
\newdimen\XLingPapertempdim
\vskip0pt plus .2pt{
\leftskip#1\relax% left glue for indent
\rightskip\XLingPapertocrmarg% right glue for for right margin
\parfillskip-\rightskip% so can go into margin if need be???
\parindent#1\relax
\interlinepenalty10000
\leavevmode
\XLingPapertempdim#2\relax% numwidth
\advance\leftskip\XLingPapertempdim\null\nobreak\hskip-\leftskip{#3}\nobreak
\XLingPaperdotfill\nobreak
\hbox to\XLingPaperpnumwidth{\hfil\normalfont\normalcolor#4}
\par}}
\newlength{\XLingPaperpnumwidth}
\newlength{\XLingPapertocrmarg}
\setlength{\XLingPaperpnumwidth}{1.55em}\setlength{\XLingPapertocrmarg}{\XLingPaperpnumwidth+1em}\newcommand{\XLingPaperindex}{\immediate\openout7 = \jobname.idx\relax
\write7{<idx>}}
\newcommand{\XLingPaperaddtoindex}[1]{\write7{<indexitem ref="#1" page="\thepage"/>}}
\newcommand{\XLingPaperindexitem}[2]{\vskip0pt plus .2pt{
\leftskip#1\relax% left glue for indent
\parindent#1\relax
\interlinepenalty10000
\leavevmode
\advance\leftskip.25in\null\nobreak\hskip-\leftskip{#2}\nobreak
\par}}
\newcommand{\XLingPaperendindex}{\write7{</idx>}\closeout7\relax
}
\newlength{\XLingPaperlistinexampleindent}\setlength{\XLingPaperlistinexampleindent}{.125in + 2.75em}
\newlength{\XLingPaperlistitemindent}
\newlength{\XLingPaperbulletlistitemwidth}\settowidth{\XLingPaperbulletlistitemwidth}{•\ }\newlength{\XLingPapersingledigitlistitemwidth}
\settowidth{\XLingPapersingledigitlistitemwidth}{8.\ }\newlength{\XLingPaperdoubledigitlistitemwidth}
\settowidth{\XLingPaperdoubledigitlistitemwidth}{88.\ }\newlength{\XLingPapertripledigitlistitemwidth}
\settowidth{\XLingPapertripledigitlistitemwidth}{888.\ }\newlength{\XLingPapersingleletterlistitemwidth}
\settowidth{\XLingPapersingleletterlistitemwidth}{m.\ }\newlength{\XLingPaperdoubleletterlistitemwidth}
\settowidth{\XLingPaperdoubleletterlistitemwidth}{mm.\ }\newlength{\XLingPapertripleletterlistitemwidth}
\settowidth{\XLingPapertripleletterlistitemwidth}{mmm.\ }\newlength{\XLingPaperromanviilistitemwidth}
\settowidth{\XLingPaperromanviilistitemwidth}{vii.\ }\newlength{\XLingPaperromanviiilistitemwidth}
\settowidth{\XLingPaperromanviiilistitemwidth}{viii.\ }\newlength{\XLingPaperromanxviiilistitemwidth}
\settowidth{\XLingPaperromanxviiilistitemwidth}{xviii.\ }\newlength{\XLingPaperspacewidth}
\settowidth{\XLingPaperspacewidth}{\ }\newcommand{\XLingPaperlistitem}[4]{
\newdimen\XLingPapertempdim
\vskip0pt plus .2pt{
\leftskip#1\relax% left glue for indent
\parindent#1\relax
\interlinepenalty10000
\leavevmode
\XLingPapertempdim#2\relax% label width
\advance\leftskip\XLingPapertempdim\null\nobreak\hskip-\leftskip\hbox to\XLingPapertempdim{\hfil\normalfont\normalcolor#3\ }{#4}\nobreak
\par}}
\newcommand{\XLingPaperexample}[5]{
\newdimen\XLingPapertempdim
\vskip0pt plus .2pt{
\leftskip#1\relax% left glue for indent
\hspace*{#1}\relax
\rightskip#2\relax% right glue for indent
\interlinepenalty10000
\leavevmode
\XLingPapertempdim#3\relax% example number width
\advance\leftskip\XLingPapertempdim\null\nobreak\hskip-\leftskip\hbox to\XLingPapertempdim{\normalfont\normalcolor#4\hfil}{#5}\nobreak
\par}}
\newcommand{\XLingPaperfree}[2]{\vskip0pt plus .2pt{
\leftskip#1\relax% left glue for indent
\parindent#1\relax
\interlinepenalty10000
\leavevmode{#2}\nobreak
\par}}
\newcommand{\XLingPaperlistinterlinear}[5]{
\newdimen\XLingPapertempdimletter
\vskip0pt plus .2pt{\hspace*{#1}\hspace*{#2}
\XLingPapertempdimletter#3\relax% letter width
\advance\leftskip\XLingPapertempdimletter\null\nobreak\hskip-\leftskip\hspace*{-.3em}\hbox to\XLingPapertempdimletter{\normalfont\normalcolor#4\ \hfil}{#5}\nobreak
\par}}
